﻿using System;

using System;

namespace IFactory
{
    class Program
    {
        static void Main(string[] args)
        {
            // 创建具体工厂
            IFactory kmeansFactory = new KmeansFactory();
            IFactory dbscanFactory = new DbscanFactory();
            IFactory hierarchicalFactory = new HierarchicalFactory();

            // 通过工厂创建聚类算法实例（依赖IClustering接口）
            IClustering kmeans = kmeansFactory.CreateClustering();
            IClustering dbscan = dbscanFactory.CreateClustering();
            IClustering hierarchical = hierarchicalFactory.CreateClustering();

            // 调用聚类方法
            kmeans.Cluster();
            dbscan.Cluster();
            hierarchical.Cluster();

            Console.ReadKey();
        }
    }
}
